{include file="public/header" /}
<body>
<style>
    .cion{
        display: inline-block;
        width: 120px;
    }
</style>
<div class="page-container">
    <form  method="get" action="">
        <div class="text-c">
            日期范围：
            <input type="text" onfocus="WdatePicker()" value="{:input('get.start')}" name="start" id="datemin" class="input-text Wdate" style="width:120px;" autocomplete="off">
             -
            <input type="text" onfocus="WdatePicker()" value="{:input('get.end')}" name="end" id="datemax" class="input-text Wdate" style="width:120px;" autocomplete="off">
            <input type="text" class="input-text" style="width:250px" placeholder="ID/订单号" value="{:input('word')}" name="word">
            <span class="select-box" style="width: 100px;">
                <select name="status" class="select">
                    <option value="-2">全部状态</option>
                     <option value="-1" {if isset($_GET['status']) && $_GET['status'] == -1}selected{/if}>未付款</option>
                    <option value="0" {if isset($_GET['status']) && $_GET['status'] == 0}selected{/if}>待发货</option>
                    <option value="1" {if isset($_GET['status']) && $_GET['status'] == 1}selected{/if}>已发货</option>
                </select>
            </span>
            <span class="select-box" style="width: 100px;">
                <select name="status" class="select">
                    <option value="-1">全部状态</option>
                    <option value="0" {if isset($_GET['status']) && $_GET['status'] == 0}selected{/if}>未支付</option>
                    <option value="1" {if isset($_GET['status']) && $_GET['status'] == 1}selected{/if}>已支付</option>
                </select>
            </span>
            <button type="submit" class="btn btn-success">搜索</button>
        </div>
    </form>

    <div class="cl pd-5 bg-1 bk-gray mt-20">
         <span class="l">

        </span>
        <span class="r">共有数据：<strong>{$list->total()}</strong> 条</span> </div>
    <table class="table table-border table-bordered table-hover table-bg">
        <thead>
            <tr>
                <th scope="col" colspan="12">卡号列表</th>
            </tr>
            <tr class="text-c">
                <th width="50">标识</th>
                <th width="100">手机号</th>
                <th width="100">卡号</th>
                <th width="80">订单</th>
                <th width="80">商品</th>
                <th width="50">状态</th>
                <th width="50">支付状态</th>
                <th width="50">处理状态</th>
                <th width="100">支付时间</th>
                <th width="100">发货时间</th>
                <th width="100">创建时间</th>
                <th width="120">备注</th>
                <!--<th width="60">操作</th>-->
            </tr>
        </thead>
        <tbody>
            {foreach $list as $v}
            <tr class="text-c">
                <td class="text-l">{$v.id}</td>
                <td class="text-l">{$v.mobile}</td>
                <td class="text-l">{$v.card}</td>
                <td class="text-l">{$v.order_id}</td>
                <td class="text-l">{$v.goods_id}</td>
                <td class="text-l">
                    {switch name="$v.status"}
                    {case value="-1"}未付款{/case}
                    {case value="0"}待发货{/case}
                    {case value="1"}已发货{/case}
                    {case value="2"}发货失败{/case}
                    {default /}--
                    {/switch}</td>
                </td>
                <td>
                    {if $v.pay_status == 1}
                    <font color="red">已支付</font>
                    {else/}
                    <font color="green">未支付</font>
                    {/if}
                </td>
                <td class="text-l">
                    {switch name="$v.deal"}
                    {case value="0"}未处理{/case}
                    {case value="1"}已处理{/case}
                    {default /}--
                    {/switch}</td>
                <td class="text-l">
                    {if $v.pay_time }
                    {:date('Y-m-d H:i:s',$v['pay_time'])}
                    {else/}
                     --
                    {/if}
                </td>
                <td class="text-l">
                    {if $v.send_time }
                    {:date('Y-m-d H:i:s',$v['send_time'])}
                    {else/}
                    --
                    {/if}
                </td>
                <td class="text-l">
                    {if $v.create_time }
                    {:date('Y-m-d H:i:s',$v['create_time'])}
                    {else/}
                    --
                    {/if}
                </td>

                <td class="text-l">{$v.remark}</td>
                <!--<td>-->
                    <!--<a class="btn-link" title="编辑" href="javascript:;" onclick="layopen('编辑','{:url('edit',['id'=>$v.id])}')">编辑</a>-->
                <!--</td>-->
            </tr>
            {/foreach}
        </tbody>
    </table>
    <div class="page">
        {$list->render()|raw}
    </div>
</div>

{include file="public/footer" /}

<script type="text/javascript">
    
    function login_web(id) {
        var info = '确认要登录此用户的网页版么？';
        layer.confirm(info,function(index){
            $.ajax({
                type: 'POST',
                url: "login_web?id="+id,
                data: {id:id},
                dataType: 'json',
                success: function(data){
                    if(data.status == 1){
                        layer.msg("操作成功",{icon:1,time:1000,shade: [0.3, '#000']},function(){
                            window.open(data.url+"?token="+data.data.token+"&json="+data.data.user);
                        });
                    }else{
                        layer.msg(data.msg,{icon:2,time:1000,shade: [0.3, '#000']});
                    }
                },
                error:function(data) {
                    console.log(data.msg);
                },
            });
        });
    }
function member_start(obj,id,status){
    if(status == 0){
        var info = '确认要启用吗？';
    }else{
        var info = '确认要禁用用户吗？,,禁用此用户将变成未激活用户，且不能登录';
    }
    layer.confirm(info,function(index){
        $.ajax({
            type: 'POST',
            url: "{:url('status')}",
            data: {id:id,status:status},
            dataType: 'json',
            success: function(data){
                if(data.status == 'y'){
                    layer.msg("操作成功",{icon:1,time:1000,shade: [0.3, '#000']},function(){
                        location.replace(location.href);
                    });
                }else{
                    layer.msg(data.info,{icon:2,time:1000,shade: [0.3, '#000']});
                }
            },
            error:function(data) {
                console.log(data.msg);
            },
        });
    });
}
function member_activity(obj,id,status){
    if(status == 0){
        var info = '确认要激活用户吗？';
    }else{
        var info = '确认要设置用户为未激活状态吗，需要去商城购买商品从新激活？';
    }
    layer.confirm(info,function(index){
        $.ajax({
            type: 'POST',
            url: "{:url('userActivity')}",
            data: {id:id,status:status},
            dataType: 'json',
            success: function(data){
                if(data.status == 'y'){
                    layer.msg("操作成功",{icon:1,time:1000,shade: [0.3, '#000']},function(){
                        location.replace(location.href);
                    });
                }else{
                    layer.msg(data.info,{icon:2,time:1000,shade: [0.3, '#000']});
                }
            },
            error:function(data) {
                console.log(data.msg);
            },
        });
    });
}

</script>